package allod.som.functions.metric

import allod.som.Lattice.Pattern
import allod.som.Metric

/**
 * Created by IntelliJ IDEA.
 * User: allod
 * Date: 6 січ 2010
 * Time: 21:39:39
 */

case object EuclideanMetric extends Metric {
  def distance(input: Pattern, weights: List[Double]): Double = {
    val items = input zip weights
    val value = (0.0 /: items)((sum, item) => sum + Math.pow(item._1 - item._2, 2))
    Math.sqrt(value)
  }

  override def toString() = "Euclidean norm"
}